package lanqiao;

import java.util.HashMap;
import java.util.Scanner;

public class 单词分析 {
    public static void main(String[] args) {
        Scanner scanner =new Scanner(System.in);
        String str = scanner.nextLine();
        process(str);
    }

    public static void process(String str){
        if (str == null || str.length()==0){
            return ;
        }
        HashMap<Character, Integer> hashMap = new HashMap<>();
        int max = Integer.MIN_VALUE;
        char ch = 'a';
        for (int i = 0; i < str.length(); i++) {
            int cur = 0;
            if (hashMap.containsKey(str.charAt(i))){
                hashMap.put(str.charAt(i),hashMap.get(str.charAt(i))+1);
                cur = hashMap.get(str.charAt(i));
            }else {
                hashMap.put(str.charAt(i),1);
                cur =1;
            }
            if (max<cur){
                ch = str.charAt(i);
                max = cur;
            }
        }
        System.out.println(ch);
        System.out.println(max);
    }
}
